package com.canbot.u05.activity.presidemode.newcode.bean;

import com.canbot.u05.control.DataUtil;

import java.io.Serializable;
import java.util.Objects;

public class VoiceBean implements Serializable {
    public int languageType;
    private boolean isSelect;

    public boolean isSelect() {
        return isSelect;
    }

    public VoiceBean(int languageType) {
        this.languageType = languageType;
    }

    public VoiceBean() {
    }

    public int getTime() {
        int time = 0;
        switch (languageType) {
            case NModuleType.VOICE_NONE:
                break;
            case NModuleType.VOICE_MUSIC:
            case NModuleType.VOICE_RECORD:
                time = this.time;
                break;
            case NModuleType.VOICE_TTS:
                time = DataUtil.getTtsTime(content);
                break;
        }
        return time;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        VoiceBean voiceBean = (VoiceBean) o;
        return languageType == voiceBean.languageType &&
                Objects.equals(content, voiceBean.content) &&
                Objects.equals(path, voiceBean.path);
    }

    @Override
    public int hashCode() {
        return Objects.hash(languageType, content, path);
    }

    public void setSelect(boolean select) {
        isSelect = select;
    }

    public String content;

    public String path;
    public int time;

    @Override
    public String toString() {
        return "VoiceBean{" +
                "languageType=" + languageType +
                ", isSelect=" + isSelect +
                ", content='" + content + '\'' +
                ", path='" + path + '\'' +
                ", time=" + time +
                '}';
    }
}
